Skip to content

refactor: move visitor creation to before/after blocks in livechat room tests#39289

Open
Copilot wants to merge 12 commits into
developfrom
copilot/create-visitor-in-before-block
Open

refactor: move visitor creation to before/after blocks in livechat room tests#39289
Copilot wants to merge 12 commits into
developfrom
copilot/create-visitor-in-before-block

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

  • Restructure describe('livechat/room') into two sub-blocks
  • Create shared before/after hooks for visitor lifecycle
  • Add roomsToClose Set mechanism to collect room IDs for cleanup
  • Move roomsToClose.add() calls before expect statements to ensure cleanup happens even if assertions fail
  • Remove room IDs from the set after successfully closing them
  • Remove TODO comments requesting this refactoring
Original prompt

This section details on the original issue you should resolve

<issue_title>this visitor should be created on before block and deleted on after block</issue_title>
<issue_description>

📝 Found in apps/meteor/tests/end-to-end/api/livechat/00-rooms.ts#L156

Commit: d9bceb4</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: Refactor Agent
A disciplined agent that performs code refactoring with a focus on improving code quality,
maintainability, and readability without changing external behavior. It ensures all tests
pass before and after changes, and creates incremental, reviewable PRs.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Mar 3, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 8.5.0, but it targets 8.4.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: e4abb2f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI and others added 2 commits March 3, 2026 14:07
…om tests

Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
…solation

Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Copy link
Copy Markdown
Member

@ggazzo ggazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot you can share the same before/after among the ones that makes sense

Copilot AI changed the title [WIP] Create visitor in before block and delete in after block refactor: move visitor creation to before/after blocks in livechat room tests Mar 3, 2026
…block

Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot you can share the same before/after among the ones that makes sense

Done in 9881835. Consolidated all tests using a standard visitor into a single describe('with a valid visitor') block with shared before/after hooks. The EE-only test remains separate since it requires a visitor with a special name.

Copy link
Copy Markdown
Member

@ggazzo ggazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a mechanism that adds the rooms to an array and then removes them in the after event, to prevent the room removal process from failing?

Copilot AI and others added 2 commits March 3, 2026 14:23
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 3, 2026

Could you create a mechanism that adds the rooms to an array and then removes them in the after event, to prevent the room removal process from failing?

Done in 7a88808. Added a roomsToClose Set that collects room IDs during tests and closes them all in the after block. Using Set to handle duplicate IDs gracefully, and .catch(() => {}) to prevent cleanup failures from blocking other tests.

Comment thread apps/meteor/tests/end-to-end/api/livechat/00-rooms.ts Outdated
Comment thread apps/meteor/tests/end-to-end/api/livechat/00-rooms.ts Outdated
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.47%. Comparing base (84754bb) to head (e4abb2f).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #39289      +/-   ##
===========================================
+ Coverage    70.14%   70.47%   +0.32%     
===========================================
  Files         3273     3263      -10     
  Lines       116240   116425     +185     
  Branches     20806    21000     +194     
===========================================
+ Hits         81538    82051     +513     
- Misses       31399    32342     +943     
+ Partials      3303     2032    -1271     
Flag Coverage Δ
unit 70.93% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread apps/meteor/tests/end-to-end/api/livechat/00-rooms.ts Outdated
@ggazzo
Copy link
Copy Markdown
Member

ggazzo commented Mar 3, 2026

/jira ARCH-1464

@ggazzo ggazzo added this to the 8.3.0 milestone Mar 3, 2026
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Mar 3, 2026
@ggazzo ggazzo marked this pull request as ready for review March 3, 2026 16:58
@ggazzo ggazzo requested a review from a team as a code owner March 3, 2026 16:58
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Mar 3, 2026
@dionisio-bot dionisio-bot Bot enabled auto-merge March 3, 2026 16:58
KevLehman
KevLehman previously approved these changes Mar 3, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@ggazzo ggazzo modified the milestones: 8.3.0, 8.4.0 Apr 6, 2026
@dionisio-bot dionisio-bot Bot added community and removed stat: ready to merge PR tested and approved waiting for merge labels Apr 6, 2026
@ggazzo ggazzo modified the milestones: 8.4.0, 8.5.0 Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community stat: QA assured Means it has been tested and approved by a company insider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

this visitor should be created on before block and deleted on after block

3 participants